package reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class Test {
    public static void main(String[] args) throws InvocationTargetException, InstantiationException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException {
        Student student = new Student();
        System.out.println(student);
        Class cls = Class.forName("reflect.Student");
        Constructor c1 = cls.getConstructor();
        Object obj = c1.newInstance();
        System.out.println(obj);
        Constructor c2 = cls.getConstructor(String.class,int.class,char.class);
        Object obj2 = c2.newInstance("李四",20,'女');
        System.out.println(obj2);
    }
}
